package cn.wolfcode.luowowo.controller;

import cn.wolfcode.luowowo.util.UploadUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 图片上传控制器
 */
@RestController
public class UploadController {


    @RequestMapping("/coverImageUpload")
    public Object uploadImg(MultipartFile pic) throws Exception {
        // 1.接受用户传过来的图片 byte数组
        // 2.上传到阿里oss服务器
        String imgPath = UploadUtil.uploadAli(pic);
        return imgPath;
    }
}
